/**
 * FileName: ProductProperty
 * Author: Wb
 * Date: 2025/9/24 15:23
 * Description:
 * History:
 */
package org.test.device.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.test.device.params.QueryProductPropertyParam;
import org.test.device.service.ProductPropertyService;
import org.test.device.utils.ResultData;
import org.test.device.vo.product.ProductPropertyVoList;

import java.util.List;

/**
 * 〈一句话功能简述〉<br>
 * 〈产品物模型Controller〉
 *
 * @author Wb
 * @create 2025/9/24
 * @since 1.0.0
 */
@Slf4j
@Tag(name = "产品物模型管理接口", description = "产品物模型注册、状态查询、数据上报相关接口")
@RestController
@RequestMapping("productProperty")
public class ProductPropertyController {

    @Autowired
    ProductPropertyService productPropertyService;

    /**
    * @Author Mr.Wang
    * @Description 查询物模型列表信息
    * @Date 16:46 2025/9/27
    * @param
    **/
    @GetMapping("list")
    public ResultData getProductPropertyList(@ParameterObject QueryProductPropertyParam param) {
        PageHelper.startPage(param.getCurrentPage(), param.getPageSize());
        List<ProductPropertyVoList> propertyVoLists = productPropertyService.getProductPropertyList(param);
        PageInfo<ProductPropertyVoList> pageInfo = new PageInfo<>(propertyVoLists);
        log.info("查询结果：{}，总数：{}，总页数：{}，当前页：{}", propertyVoLists, pageInfo.getTotal(), pageInfo.getPages(), pageInfo.getPageNum());
        return ResultData.pageResponse(propertyVoLists, pageInfo.getTotal(), pageInfo.getPages(), pageInfo.getPageNum());
    }
}